home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Configuration / sAVe the Disk 1.2.1 / Read Me next >
Text File  |  1993-12-07  |  11KB  |  234 lines

  1. sAVe the Disk 1.2.1
  2. -------------------
  3.  
  4. Overview
  5.  
  6. sAVe the Disk 1.2.1 is a FreeWare system extension (aka INIT) which will
  7. alleviate the excessive disk drive hits experienced by owners of AV Macs
  8. in the following two circumstances:
  9.  
  10. 1) The traps ChangedResource and AddResource flush the whole file to disk each
  11.    time they are invoked. This significantly degrades performance if many
  12.    resources are changed in succession, e.g. while linking programs or running
  13.    resource compilers.
  14.  
  15. 2) Each time a sound channel is allocated (disposed) some information is read
  16.    from (written to) the file DSP Preferences. Applications which follow Apple's
  17.    recommendations create and destroy such a channel for each single sound they
  18.    produce and thus slow down while they torture your harddisk. This problem
  19.    becomes most obvious with games.
  20.  
  21. Note that the extension AV Speedup 1.0 (developed by Matt Gough and Brian Stroud)
  22. addresses only the first set of problems, while sAVe the Disk deals with the
  23. sound related stuff, too.
  24.  
  25.  
  26. Installation
  27.  
  28. Simply drop the sAVe the Disk extension onto the icon of the closed system
  29. folder and let the Finder place it in the Extensions folder. Then restart your
  30. machine. sAVe the Disk 1.2.1 will load and display its icon while it installs
  31. itself during start-up.
  32.  
  33.  
  34. Does it work?
  35.  
  36. The following is a simple way to test if sAVe the Disk is operating properly. In
  37. the Finder select Page Setup from the File menu and click _outside_ the dialog
  38. box several times. The system beep should sound for each click. However disk
  39. activity should only occur prior to the first beep when the actual sound data is
  40. read from its resource inside the system file. There should be no disk hits for
  41. the repeated sounds. Compare this with the ongoing disk accesses before you
  42. installed sAVe the Disk. Now you could enjoy one of your former favorite games
  43. without disk noise and without jerky delays degrading animation. The increased
  44. speed of some Resource Manager operations should be noticeable when building
  45. large programs.
  46.  
  47.  
  48. If it doesn't work
  49.  
  50. As sAVe the Disk uses only 2.2k of system memory plus the size of your DSP
  51. Preferences file (usually less than 0.5k) there should always be sufficient
  52. memory available.
  53.  
  54. The extension will only install itself, if ROM version 1917 (0x77D) is present.
  55. This is intended to prevent problems if somebody tries to use sAVe the Disk on
  56. a non-AV Mac. No icon will be displayed during start-up and no changes to the
  57. system will be made, if the ROM version does not match.
  58.  
  59. I developed and tested sAVe the Disk on my Centris/Quadra 660av running System
  60. 7.1 and version 1.1 of the System Enabler 088, but it is known to work on a
  61. Quadra 840av, too. Some additional testing has been done whith the 1.0 Enabler.
  62. Although it has not caused me any trouble I'm not responsible for any (unlikely)
  63. problems you may experience.
  64.  
  65. Please note that sAVe the Disk does _not_ fix the problems with games which
  66. write to the (on the AV Macs nonexistent) Apple Sound Chip directly and
  67. therefore produce no sound at all. You should contact the publisher of such
  68. software and ask for a fix or update.
  69.  
  70. Feel free to contact me at the address given below if you encounter any problems
  71. related to sAVe the Disk 1.2.1.
  72.  
  73.  
  74. Known Problems
  75.  
  76. None (again). Oh, but you can't look at the modification time of DSP Preferences
  77. to find out when your Mac has last beeped anymore ;^)
  78.  
  79.  
  80. How does it work?
  81. (optional reading)
  82.  
  83. 1) Resource Manager
  84.  
  85.    ChangedResource, AddResource are head-patched to set a flag. The modified
  86.    version of FlushFile (another head-patch) will check this flag, clear it and
  87.    suppress the actual flushing of the file if the flag was set. This works
  88.    because both resource calls contain exactly one internal call to the
  89.    FlushFile trap. A final head-patch to ResError does also clear the flag, so
  90.    that the next call to FlushFile will operate normaly, even if
  91.    ChangedResource/AddResource returned an error before calling FlushFile on
  92.    their own. Programs should be calling ResError afterwards, as this is the
  93.    only way to check the success of ChangedResource/AddResource.
  94.  
  95. 2) DSP Preferences
  96.  
  97.    Two subfunctions of the DSPDispatch trap (ABF5) access the file DSP
  98.    Preferences inside the Preferences folder and cause the sound related disk
  99.    hits (selector 0x121 to read info, 0x5F to update the info). Both
  100.    subfunctions are replaced by entirely new routines modelled after the
  101.    originals. When the DSP Preferences file is first accessed, its contents are
  102.    stored in a relocatable block inside the system heap. Further accesses just
  103.    read the info from memory, update it in memory or grow the block and append
  104.    new information. A shutdown handler will finally update the file on disk
  105.    before you restart or shutdown you Macintosh. This should cause no problems
  106.    as the DSP Preferences file is small (usually less than 500 bytes) and the
  107.    updated information records past DSP performance data as an estimate for
  108.    future uses. Thus it is no real problem if a system crash should keep the
  109.    data from getting written back. The estimates used will just be slightly less
  110.    accurate as they result from older measurements.
  111.    
  112.    Another subfunction of the DSPDispatch trap is used to repeatedly read a
  113.    resource of type 'dspf' from the System Enabler 088 and will DetachResource
  114.    in order to return a non-resource handle to its caller. Thus the resource
  115.    data is read from disk each time, still resulting in sound related disk
  116.    trashing under the 1.0 Enabler. With the 1.1 Enabler the system's disk cache
  117.    was usually able to prevent actual disk access. A head-patch to the
  118.    DSPGetResource subfunction (0x124) will handle requests for resources of type
  119.    'dspf' and use HandToHand in order to copy the requested data into a new
  120.    non-resource handle. The original resource handle is marked purgable so that
  121.    its 4.5k can be reclaimed if the system runs out of memory (the resource will
  122.    be reread from disk the next time it is accessed). For resource types other
  123.    than 'dspf' and in case of any error the patch invokes the original ROM code.
  124.    The ROM code seems to support an additional special resource file, which is
  125.    examined if a request can't be satisfied by the currently open files.
  126.    Although this feature appears to be currently unused, the fallback to the
  127.    original routine should guarantee 100% compatibility.
  128.  
  129. If you want to trash your DSP Preferences file because it has grown too large,
  130. proceed as follows: restart your Mac and put the file into the trash before any
  131. sound is produced (except the usual noise at start-up). Hold down the SHIFT-key
  132. during start-up to prevent other extensions from accessing the Sound Manager
  133. before the Finder has been started, if required. After the first sound has been
  134. played the file is kept in memory and will be completely rewritten at shutdown
  135. (or prior to a restart) even if you trashed it.
  136.  
  137.  
  138. The Original Note on 840AV Disk-Trashing
  139. (as distributed with AV Speedup 1.0)
  140.  
  141. There are at least two serious disk-related bugs in the 840AV, which have been
  142. verified by DTS:
  143.  
  144. 1) ChangedResource now flushes the resource's entire file out to disk.  This is
  145. first noticeable during a System install, when the Installer will take several
  146. minutes to construct the System file.  But it is most heinous during MPW Rez
  147. and Link.  My project takes 5 to 10 times longer to build (than on an 800)
  148. because the entire file is written to disk hundreds or thousands of times in
  149. rapid succession as each resource is added to my app.  Of course, this bug will
  150. make any program run slower if it adds, changes or deletes resources.
  151.  
  152. 2) SndDisposeChannel will hit the disk for some retarded reason.  Apple says
  153. the DSP chip is behind this.  Every time a system beep is played, for example,
  154. you'll notice a couple of "ca-chunks" from your hard disk.  This is especially
  155. harsh on sound-intensive applications (like games).  Many games slow down to a
  156. jerky crawl because they typically call SndDisposeChannel after each sampled
  157. sound completes.  The workaround is to leave a sound channel open and reuse
  158. it for each sampled sound until you quit or suspend your app.
  159.  
  160. Apple DTS classifies these bugs as "goofinesses", and currently offers no plans
  161. to fix them.
  162.  
  163. Todd Ouzts
  164.  
  165. Author: DAYNA
  166.  
  167.  
  168. Many Thanks To
  169.  
  170. Dave Schutz for the icon (taken from his Colossal Icons collection). Otherwise
  171. sAVe the Disk would have to go with the default icon for system extensions and
  172. would have no super hero to stand behind its noble aim.
  173.  
  174. Matt Gough and Brian Stroud who brought the Resource Manager deficiencies to my
  175. attention and made me put my vague ideas about a solution to the sound problem
  176. into actual code. From their AV Speedup distribution I got to know that there
  177. was no point in waiting for a fix from DTS (see note above).
  178.  
  179. Malcolm Slaney from the ATG Perception Group who made the source to the DSP
  180. related application VUMeter publicly available. The included headers shed some
  181. light onto the DSP trap interface and turned mysterious entities into
  182. comprehensible data structures.
  183.  
  184. Patrick C. Beard who placed his ShowIconFamily code in the public domain. He
  185. made the successful installation of sAVe the Disk visible.
  186.  
  187.  
  188. Legal Stuff
  189.  
  190. sAVe the Disk 1.2.1 is provided free of charge but remains copyright Michael
  191. Thies. It may not be sold for profit but may otherwise be distributed freely in
  192. unmodified form and complete with this unaltered documentation. It may be
  193. included with ShareWare or commercial products, if I have been informed of the
  194. intended bundling in advance and it is made clear that sAVe the Disk itself
  195. comes free of charge and does not form part of the actual product sold.
  196.  
  197. sAVe the Disk 1.2.1 is provided in the hope that it will be useful but comes
  198. with _absolutely_ NO warranty.
  199.  
  200. It was developed with THINK C 6.0.1 so parts of it may be Copyright Symantec
  201. Corporation.
  202.  
  203. Several terms used above are trademarks of their respective holders.
  204.  
  205.  
  206. Version History
  207.  
  208. 1.0    11/23/93    Initial Version
  209. 1.1    11/25/93    - fixed bug which could prevent access to prefs file
  210.                    - UpdateGPBPrefFile subfunction will read prefs file into
  211.                      memory, if GetGPBModes was never called before
  212.                    - Resource Manager patches are more robust. Even in case of
  213.                      errors no call to FlushFile should get accidently ignored.
  214.                    - Icon gets displayed during start-up if installation
  215.                      successful
  216.                    - fine-tuned code
  217. 1.1.1  12/04/93    - added compatibility with version 1.0 of the System Enabler
  218.                      (additional work will be needed to prevent ALL disk
  219.                       trashing with the 1.0 Enabler)
  220.                    - more work done at installation time => less resident code
  221. 1.2    12/05/93    - work around for 1.0 Enabler added: no more disk trashing
  222.                    - no reliance on systems's disk cache with any Enabler
  223.                    - resident code nearly back to old (v1.1) size :-(
  224. 1.2.1  12/07/93    - create copy of 'dspf' resource in heap zone where resource
  225.                      was loaded (application vs. system heap)
  226.  
  227. I am always interested in comments, suggestions and bug reports (sigh).
  228.  
  229. ---------------------------------------------------
  230. Michael Thies            (andymon@uni-paderborn.de)
  231. Fachbereich Informatik
  232. Universitaet-Gesamthochschule Paderborn
  233. Germany
  234.